package com.xbongbong.paas.elasticsearch.pojo;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;

import java.io.Serializable;

/**
 * 子级聚合有【多个】字段同时聚合计算
 * @author zcp
 * @version v1.0
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class AggSubFactoriesPojo implements Serializable {
    private static final long serialVersionUID = -5608795154048780188L;

    /**
     * 第一层聚合桶名
     */
    private String aggs;
    /**
     * 第二层第1个聚合桶名
     */
    private String aggsSub1;
    /**
     * 第二层第2个聚合桶名
     */
    private String aggsSub2;
    /**
     * 第二层第3个聚合桶名
     */
    private String aggsSub3;

    /**
     * TermsAggregationBuilder
     */
    private TermsAggregationBuilder termsAggregationBuilder;

    public AggSubFactoriesPojo(){
        this.aggs = "aggs01";
        this.aggsSub1 = "aggs021";
        this.aggsSub2 = "aggs022";
        this.aggsSub3 = "aggs023";
        this.termsAggregationBuilder = AggregationBuilders.terms(aggs);
    }
}
